/*****************************************************
 * PS5 SDK - Libc
 * Implements resolving for libc.
 ****************************************************/

#define CRT_BUILD
#include <ps5/libc.h>

extern int sceKernelLoadStartModule(const char *name, uint64_t argc, const void *argv, uint32_t flags, void *, int *result);

int libc_init()
{
	int libc = sceKernelLoadStartModule("libSceLibcInternal.sprx", 0, 0, 0, 0, 0);
	if (__dlsym_init != 1) {
		return -1;
	}

	DYNLIB_RESOLVE(libc, atexit);
	DYNLIB_RESOLVE(libc, snprintf);
	DYNLIB_RESOLVE(libc, abs);
	DYNLIB_RESOLVE(libc, asctime);
	DYNLIB_RESOLVE(libc, atoi);
	DYNLIB_RESOLVE(libc, atol);
	DYNLIB_RESOLVE(libc, atoll);
	DYNLIB_RESOLVE(libc, bsearch);
	DYNLIB_RESOLVE(libc, btowc);
	DYNLIB_RESOLVE(libc, c16rtomb);
	DYNLIB_RESOLVE(libc, c32rtomb);
	DYNLIB_RESOLVE(libc, ctime);
	DYNLIB_RESOLVE(libc, asctime_s);
	DYNLIB_RESOLVE(libc, bsearch_s);
	DYNLIB_RESOLVE(libc, ctime_s);
	DYNLIB_RESOLVE(libc, fopen_s);
	DYNLIB_RESOLVE(libc, fprintf_s);
	DYNLIB_RESOLVE(libc, freopen_s);
	DYNLIB_RESOLVE(libc, fscanf_s);
	DYNLIB_RESOLVE(libc, fwprintf_s);
	DYNLIB_RESOLVE(libc, fwscanf_s);
	DYNLIB_RESOLVE(libc, gets_s);
	DYNLIB_RESOLVE(libc, gmtime_s);
	DYNLIB_RESOLVE(libc, localtime_s);
	DYNLIB_RESOLVE(libc, mbsrtowcs_s);
	DYNLIB_RESOLVE(libc, mbstowcs_s);
	DYNLIB_RESOLVE(libc, memset_s);
	DYNLIB_RESOLVE(libc, printf_s);
	DYNLIB_RESOLVE(libc, qsort_s);
	DYNLIB_RESOLVE(libc, scanf_s);
	DYNLIB_RESOLVE(libc, snprintf_s);
	DYNLIB_RESOLVE(libc, snwprintf_s);
	DYNLIB_RESOLVE(libc, sprintf_s);
	DYNLIB_RESOLVE(libc, sscanf_s);
	DYNLIB_RESOLVE(libc, strcat_s);
	DYNLIB_RESOLVE(libc, strcpy_s);
	DYNLIB_RESOLVE(libc, strerrorlen_s);
	DYNLIB_RESOLVE(libc, strerror_s);
	DYNLIB_RESOLVE(libc, strncat_s);
	DYNLIB_RESOLVE(libc, strncpy_s);
	DYNLIB_RESOLVE(libc, strtok_s);
	DYNLIB_RESOLVE(libc, swprintf_s);
	DYNLIB_RESOLVE(libc, swscanf_s);
	DYNLIB_RESOLVE(libc, vfprintf_s);
	DYNLIB_RESOLVE(libc, vfscanf_s);
	DYNLIB_RESOLVE(libc, vfwprintf_s);
	DYNLIB_RESOLVE(libc, vfwscanf_s);
	DYNLIB_RESOLVE(libc, vprintf_s);
	DYNLIB_RESOLVE(libc, vscanf_s);
	DYNLIB_RESOLVE(libc, vsnprintf_s);
	DYNLIB_RESOLVE(libc, vsnwprintf_s);
	DYNLIB_RESOLVE(libc, vsprintf_s);
	DYNLIB_RESOLVE(libc, vsscanf_s);
	DYNLIB_RESOLVE(libc, vswprintf_s);
	DYNLIB_RESOLVE(libc, vswscanf_s);
	DYNLIB_RESOLVE(libc, vwprintf_s);
	DYNLIB_RESOLVE(libc, vwscanf_s);
	DYNLIB_RESOLVE(libc, wcrtomb_s);
	DYNLIB_RESOLVE(libc, wcscat_s);
	DYNLIB_RESOLVE(libc, wcscpy_s);
	DYNLIB_RESOLVE(libc, wcsncat_s);
	DYNLIB_RESOLVE(libc, wcsncpy_s);
	DYNLIB_RESOLVE(libc, wcsnlen_s);
	DYNLIB_RESOLVE(libc, wcsrtombs_s);
	DYNLIB_RESOLVE(libc, wcstok_s);
	DYNLIB_RESOLVE(libc, wcstombs_s);
	DYNLIB_RESOLVE(libc, wctomb_s);
	DYNLIB_RESOLVE(libc, wprintf_s);
	DYNLIB_RESOLVE(libc, wscanf_s);
	DYNLIB_RESOLVE(libc, difftime);
	DYNLIB_RESOLVE(libc, xtime_get);
	DYNLIB_RESOLVE(libc, drand48);
	DYNLIB_RESOLVE(libc, erand48);
	DYNLIB_RESOLVE(libc, jrand48);
	DYNLIB_RESOLVE(libc, lcong48);
	DYNLIB_RESOLVE(libc, lrand48);
	DYNLIB_RESOLVE(libc, mrand48);
	DYNLIB_RESOLVE(libc, nrand48);
	DYNLIB_RESOLVE(libc, seed48);
	DYNLIB_RESOLVE(libc, srand48);
	DYNLIB_RESOLVE(libc, fclose);
	DYNLIB_RESOLVE(libc, fcloseall);
	DYNLIB_RESOLVE(libc, fflush);
	DYNLIB_RESOLVE(libc, free);
	DYNLIB_RESOLVE(libc, feof);
	DYNLIB_RESOLVE(libc, feof_unlocked);
	DYNLIB_RESOLVE(libc, flockfile);
	DYNLIB_RESOLVE(libc, ftrylockfile);
	DYNLIB_RESOLVE(libc, funlockfile);
	DYNLIB_RESOLVE(libc, ferror);
	DYNLIB_RESOLVE(libc, ferror_unlocked);
	DYNLIB_RESOLVE(libc, fpurge);
	DYNLIB_RESOLVE(libc, fgetc);
	DYNLIB_RESOLVE(libc, getc_unlocked);
	DYNLIB_RESOLVE(libc, getchar_unlocked);
	DYNLIB_RESOLVE(libc, fgetpos);
	DYNLIB_RESOLVE(libc, fgets);
	DYNLIB_RESOLVE(libc, fgetwc);
	DYNLIB_RESOLVE(libc, fgetws);
	DYNLIB_RESOLVE(libc, fopen);
	DYNLIB_RESOLVE(libc, fprintf);
	DYNLIB_RESOLVE(libc, fputc);
	DYNLIB_RESOLVE(libc, putc_unlocked);
	DYNLIB_RESOLVE(libc, putchar_unlocked);
	DYNLIB_RESOLVE(libc, fputs);
	DYNLIB_RESOLVE(libc, fputwc);
	DYNLIB_RESOLVE(libc, fputws);
	DYNLIB_RESOLVE(libc, fread);
	DYNLIB_RESOLVE(libc, freopen);
	DYNLIB_RESOLVE(libc, fscanf);
	DYNLIB_RESOLVE(libc, fseek);
	DYNLIB_RESOLVE(libc, fseeko);
	DYNLIB_RESOLVE(libc, fsetpos);
	DYNLIB_RESOLVE(libc, ftell);
	DYNLIB_RESOLVE(libc, ftello);
	DYNLIB_RESOLVE(libc, fwide);
	DYNLIB_RESOLVE(libc, fwprintf);
	DYNLIB_RESOLVE(libc, fwrite);
	DYNLIB_RESOLVE(libc, fwscanf);
	DYNLIB_RESOLVE(libc, getc);
	DYNLIB_RESOLVE(libc, getchar);
	DYNLIB_RESOLVE(libc, gets);
	DYNLIB_RESOLVE(libc, getw);
	DYNLIB_RESOLVE(libc, getwc);
	DYNLIB_RESOLVE(libc, getwchar);
	DYNLIB_RESOLVE(libc, gmtime);
	DYNLIB_RESOLVE(libc, imaxabs);
	DYNLIB_RESOLVE(libc, imaxdiv);
	DYNLIB_RESOLVE(libc, isalnum);
	DYNLIB_RESOLVE(libc, isalpha);
	DYNLIB_RESOLVE(libc, isblank);
	DYNLIB_RESOLVE(libc, iscntrl);
	DYNLIB_RESOLVE(libc, isdigit);
	DYNLIB_RESOLVE(libc, isgraph);
	DYNLIB_RESOLVE(libc, islower);
	DYNLIB_RESOLVE(libc, isprint);
	DYNLIB_RESOLVE(libc, ispunct);
	DYNLIB_RESOLVE(libc, isspace);
	DYNLIB_RESOLVE(libc, isupper);
	DYNLIB_RESOLVE(libc, iswalnum);
	DYNLIB_RESOLVE(libc, iswalpha);
	DYNLIB_RESOLVE(libc, iswblank);
	DYNLIB_RESOLVE(libc, iswcntrl);
	DYNLIB_RESOLVE(libc, iswctype);
	DYNLIB_RESOLVE(libc, iswdigit);
	DYNLIB_RESOLVE(libc, iswgraph);
	DYNLIB_RESOLVE(libc, iswlower);
	DYNLIB_RESOLVE(libc, iswprint);
	DYNLIB_RESOLVE(libc, iswpunct);
	DYNLIB_RESOLVE(libc, iswspace);
	DYNLIB_RESOLVE(libc, iswupper);
	DYNLIB_RESOLVE(libc, iswxdigit);
	DYNLIB_RESOLVE(libc, isxdigit);
	DYNLIB_RESOLVE(libc, labs);
	DYNLIB_RESOLVE(libc, llabs);
	DYNLIB_RESOLVE(libc, localeconv);
	DYNLIB_RESOLVE(libc, localtime);
	DYNLIB_RESOLVE(libc, mblen);
	DYNLIB_RESOLVE(libc, mbrlen);
	DYNLIB_RESOLVE(libc, mbrtoc16);
	DYNLIB_RESOLVE(libc, mbrtoc32);
	DYNLIB_RESOLVE(libc, mbrtowc);
	DYNLIB_RESOLVE(libc, mbsinit);
	DYNLIB_RESOLVE(libc, mbsrtowcs);
	DYNLIB_RESOLVE(libc, mbstowcs);
	DYNLIB_RESOLVE(libc, mbtowc);
	DYNLIB_RESOLVE(libc, mktime);
	DYNLIB_RESOLVE(libc, perror);
	DYNLIB_RESOLVE(libc, printf);
	DYNLIB_RESOLVE(libc, putc);
	DYNLIB_RESOLVE(libc, putchar);
	DYNLIB_RESOLVE(libc, puts);
	DYNLIB_RESOLVE(libc, putw);
	DYNLIB_RESOLVE(libc, putwc);
	DYNLIB_RESOLVE(libc, putwchar);
	DYNLIB_RESOLVE(libc, qsort);
	DYNLIB_RESOLVE(libc, rewind);
	DYNLIB_RESOLVE(libc, scanf);
	DYNLIB_RESOLVE(libc, setbuf);
	DYNLIB_RESOLVE(libc, setlocale);
	DYNLIB_RESOLVE(libc, setvbuf);
	DYNLIB_RESOLVE(libc, memcpy);
	DYNLIB_RESOLVE(libc, sprintf);
	DYNLIB_RESOLVE(libc, sscanf);
	DYNLIB_RESOLVE(libc, strcoll);
	DYNLIB_RESOLVE(libc, strerror);
	DYNLIB_RESOLVE(libc, strerror_r);
	DYNLIB_RESOLVE(libc, strftime);
	DYNLIB_RESOLVE(libc, strncat);
	DYNLIB_RESOLVE(libc, strpbrk);
	DYNLIB_RESOLVE(libc, strstr);
	DYNLIB_RESOLVE(libc, strtoimax);
	DYNLIB_RESOLVE(libc, strtok);
	DYNLIB_RESOLVE(libc, strtol);
	DYNLIB_RESOLVE(libc, strtold);
	DYNLIB_RESOLVE(libc, strtoll);
	DYNLIB_RESOLVE(libc, strtoul);
	DYNLIB_RESOLVE(libc, strtoull);
	DYNLIB_RESOLVE(libc, strtoumax);
	DYNLIB_RESOLVE(libc, strxfrm);
	DYNLIB_RESOLVE(libc, swprintf);
	DYNLIB_RESOLVE(libc, swscanf);
	DYNLIB_RESOLVE(libc, tolower);
	DYNLIB_RESOLVE(libc, toupper);
	DYNLIB_RESOLVE(libc, towctrans);
	DYNLIB_RESOLVE(libc, towlower);
	DYNLIB_RESOLVE(libc, towupper);
	DYNLIB_RESOLVE(libc, daylight);
	DYNLIB_RESOLVE(libc, timezone);
#if 0
	DLD_RESOLVE(libc, tzname, char **); // *FIXME* error: array type 'char **[]' is not assignable , change tzname to char **
#endif
	DYNLIB_RESOLVE(libc, tzset);
	DYNLIB_RESOLVE(libc, ungetc);
	DYNLIB_RESOLVE(libc, ungetwc);
	DYNLIB_RESOLVE(libc, vfprintf);
	DYNLIB_RESOLVE(libc, vfscanf);
	DYNLIB_RESOLVE(libc, vfwprintf);
	DYNLIB_RESOLVE(libc, vfwscanf);
	DYNLIB_RESOLVE(libc, vprintf);
	DYNLIB_RESOLVE(libc, vscanf);
	DYNLIB_RESOLVE(libc, vsnprintf);
	DYNLIB_RESOLVE(libc, vsprintf);
	DYNLIB_RESOLVE(libc, vsscanf);
	DYNLIB_RESOLVE(libc, vswprintf);
	DYNLIB_RESOLVE(libc, vswscanf);
	DYNLIB_RESOLVE(libc, vwprintf);
	DYNLIB_RESOLVE(libc, vwscanf);
	DYNLIB_RESOLVE(libc, wcrtomb);
	DYNLIB_RESOLVE(libc, wcscat);
	DYNLIB_RESOLVE(libc, wcschr);
	DYNLIB_RESOLVE(libc, wcscmp);
	DYNLIB_RESOLVE(libc, wcscoll);
	DYNLIB_RESOLVE(libc, wcscpy);
	DYNLIB_RESOLVE(libc, wcscspn);
	DYNLIB_RESOLVE(libc, wcsftime);
	DYNLIB_RESOLVE(libc, wcslen);
	DYNLIB_RESOLVE(libc, wcsncat);
	DYNLIB_RESOLVE(libc, wcsncmp);
	DYNLIB_RESOLVE(libc, wcsncpy);
	DYNLIB_RESOLVE(libc, wcspbrk);
	DYNLIB_RESOLVE(libc, wcsrchr);
	DYNLIB_RESOLVE(libc, wcsrtombs);
	DYNLIB_RESOLVE(libc, wcsspn);
	DYNLIB_RESOLVE(libc, wcsstr);
	DYNLIB_RESOLVE(libc, wcstoimax);
	DYNLIB_RESOLVE(libc, wcstok);
	DYNLIB_RESOLVE(libc, wcstol);
	DYNLIB_RESOLVE(libc, wcstold);
	DYNLIB_RESOLVE(libc, wcstoll);
	DYNLIB_RESOLVE(libc, wcstombs);
	DYNLIB_RESOLVE(libc, wcstoul);
	DYNLIB_RESOLVE(libc, wcstoull);
	DYNLIB_RESOLVE(libc, wcstoumax);
	DYNLIB_RESOLVE(libc, wcsxfrm);
	DYNLIB_RESOLVE(libc, wctob);
	DYNLIB_RESOLVE(libc, wctomb);
	DYNLIB_RESOLVE(libc, wctrans);
	DYNLIB_RESOLVE(libc, wctype);
	DYNLIB_RESOLVE(libc, wmemchr);
	DYNLIB_RESOLVE(libc, wmemcmp);
	DYNLIB_RESOLVE(libc, wprintf);
	DYNLIB_RESOLVE(libc, wscanf);
	DYNLIB_RESOLVE(libc, malloc);
	DYNLIB_RESOLVE(libc, memchr);
	DYNLIB_RESOLVE(libc, strchr);
	DYNLIB_RESOLVE(libc, strcspn);
	DYNLIB_RESOLVE(libc, strlen);
	DYNLIB_RESOLVE(libc, ldiv);
	DYNLIB_RESOLVE(libc, div);
	DYNLIB_RESOLVE(libc, sceLibcOnce);
	DYNLIB_RESOLVE(libc, rand);
	DYNLIB_RESOLVE(libc, rand_r);
	DYNLIB_RESOLVE(libc, srand);
	DYNLIB_RESOLVE(libc, strcasecmp);
	DYNLIB_RESOLVE(libc, strdup);
	DYNLIB_RESOLVE(libc, strncasecmp);
	DYNLIB_RESOLVE(libc, strtok_r);
	DYNLIB_RESOLVE(libc, fgetln);
	DYNLIB_RESOLVE(libc, syslog);
	DYNLIB_RESOLVE(libc, vsyslog);
	DYNLIB_RESOLVE(libc, asprintf);
	DYNLIB_RESOLVE(libc, bcopy);
	DYNLIB_RESOLVE(libc, memmove);
	DYNLIB_RESOLVE(libc, memcpy_s);
	DYNLIB_RESOLVE(libc, memmove_s);
	DYNLIB_RESOLVE(libc, memset);
	DYNLIB_RESOLVE(libc, strncmp);
	DYNLIB_RESOLVE(libc, strncpy);
	DYNLIB_RESOLVE(libc, strnlen_s);
	DYNLIB_RESOLVE(libc, strrchr);
	DYNLIB_RESOLVE(libc, vasprintf);
	DYNLIB_RESOLVE(libc, wmemcpy);
	DYNLIB_RESOLVE(libc, wmemcpy_s);
	DYNLIB_RESOLVE(libc, wmemmove);
	DYNLIB_RESOLVE(libc, wmemmove_s);
	DYNLIB_RESOLVE(libc, wmemset);
	DYNLIB_RESOLVE(libc, abort);
	DYNLIB_RESOLVE(libc, abort_handler_s);
	DYNLIB_RESOLVE(libc, ignore_handler_s);
	DYNLIB_RESOLVE(libc, set_constraint_handler_s);
	DYNLIB_RESOLVE(libc, calloc);
	DYNLIB_RESOLVE(libc, sceLibcDebugOut);
	DYNLIB_RESOLVE(libc, stderr);
	DYNLIB_RESOLVE(libc, stdin);
	DYNLIB_RESOLVE(libc, stdout);
	DYNLIB_RESOLVE(libc, sceLibcHeapGetAddressRanges);
	DYNLIB_RESOLVE(libc, sceLibcHeapSetAddressRangeCallback);
	DYNLIB_RESOLVE(libc, sceLibcMspaceGetAddressRanges);
	DYNLIB_RESOLVE(libc, aligned_alloc);
	DYNLIB_RESOLVE(libc, malloc_check_memory_bounds);
	DYNLIB_RESOLVE(libc, malloc_finalize);
	DYNLIB_RESOLVE(libc, malloc_get_footer_value);
	DYNLIB_RESOLVE(libc, malloc_get_malloc_state);
	DYNLIB_RESOLVE(libc, malloc_initialize);
	DYNLIB_RESOLVE(libc, malloc_report_memory_blocks);
	DYNLIB_RESOLVE(libc, malloc_stats);
	DYNLIB_RESOLVE(libc, malloc_stats_fast);
	DYNLIB_RESOLVE(libc, malloc_usable_size);
	DYNLIB_RESOLVE(libc, memalign);
	DYNLIB_RESOLVE(libc, posix_memalign);
	DYNLIB_RESOLVE(libc, realloc);
	DYNLIB_RESOLVE(libc, reallocalign);
	DYNLIB_RESOLVE(libc, sceLibcInternalSetMallocCallback);
	DYNLIB_RESOLVE(libc, sceLibcMspaceCalloc);
	DYNLIB_RESOLVE(libc, sceLibcMspaceFree);
	DYNLIB_RESOLVE(libc, sceLibcMspaceMalloc);
	DYNLIB_RESOLVE(libc, sceLibcMspaceMallocStats);
	DYNLIB_RESOLVE(libc, sceLibcMspaceMallocStatsFast);
	DYNLIB_RESOLVE(libc, sceLibcMspaceMallocUsableSize);
	DYNLIB_RESOLVE(libc, sceLibcMspaceMemalign);
	DYNLIB_RESOLVE(libc, sceLibcMspacePosixMemalign);
	DYNLIB_RESOLVE(libc, sceLibcHeapMutexCalloc);
	DYNLIB_RESOLVE(libc, sceLibcHeapMutexFree);
	DYNLIB_RESOLVE(libc, sceLibcHeapSetTraceMarker);
	DYNLIB_RESOLVE(libc, sceLibcHeapUnsetTraceMarker);
	DYNLIB_RESOLVE(libc, sceLibcInternalMemoryGetWakeAddr);
	DYNLIB_RESOLVE(libc, sceLibcInternalMemoryMutexEnable);
	DYNLIB_RESOLVE(libc, sceLibcMspaceAlignedAlloc);
	DYNLIB_RESOLVE(libc, sceLibcMspaceCreate);
	DYNLIB_RESOLVE(libc, sceLibcMspaceDestroy);
	DYNLIB_RESOLVE(libc, sceLibcMspaceIsHeapEmpty);
	DYNLIB_RESOLVE(libc, sceLibcMspaceRealloc);
	DYNLIB_RESOLVE(libc, sceLibcMspaceReallocalign);
	DYNLIB_RESOLVE(libc, sceLibcMspaceSetMallocCallback);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceCalloc);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceCheckMemoryBounds);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceCreate);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceDestroy);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceFree);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceGetFooterValue);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceIsHeapEmpty);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceMalloc);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceMallocStats);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceMallocStatsFast);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceMallocUsableSize);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceMemalign);
	DYNLIB_RESOLVE(libc, sceLibcPafMspacePosixMemalign);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceRealloc);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceReallocalign);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceReportMemoryBlocks);
	DYNLIB_RESOLVE(libc, sceLibcPafMspaceTrim);
	DYNLIB_RESOLVE(libc, fdopen);
	DYNLIB_RESOLVE(libc, fileno);
	DYNLIB_RESOLVE(libc, fileno_unlocked);
	DYNLIB_RESOLVE(libc, at_quick_exit);
	DYNLIB_RESOLVE(libc, quick_exit);
	DYNLIB_RESOLVE(libc, strtof);
	DYNLIB_RESOLVE(libc, wcstof);
	DYNLIB_RESOLVE(libc, remove);
	DYNLIB_RESOLVE(libc, acoshl);
	DYNLIB_RESOLVE(libc, asinhl);
	DYNLIB_RESOLVE(libc, atanhl);
	DYNLIB_RESOLVE(libc, coshl);
	DYNLIB_RESOLVE(libc, erfcl);
	DYNLIB_RESOLVE(libc, erfl);
	DYNLIB_RESOLVE(libc, expl);
	DYNLIB_RESOLVE(libc, expm1l);
	DYNLIB_RESOLVE(libc, fabs);
	DYNLIB_RESOLVE(libc, hypot3);
	DYNLIB_RESOLVE(libc, hypot3f);
	DYNLIB_RESOLVE(libc, hypot3l);
	DYNLIB_RESOLVE(libc, ldexp);
	DYNLIB_RESOLVE(libc, lgammal);
	DYNLIB_RESOLVE(libc, log10l);
	DYNLIB_RESOLVE(libc, log1pl);
	DYNLIB_RESOLVE(libc, log2l);
	DYNLIB_RESOLVE(libc, logl);
	DYNLIB_RESOLVE(libc, modf);
	DYNLIB_RESOLVE(libc, nan);
	DYNLIB_RESOLVE(libc, nanf);
	DYNLIB_RESOLVE(libc, nanl);
	DYNLIB_RESOLVE(libc, powl);
	DYNLIB_RESOLVE(libc, sinhl);
	DYNLIB_RESOLVE(libc, tanhl);
	DYNLIB_RESOLVE(libc, tgammal);
	DYNLIB_RESOLVE(libc, fegetround);
	DYNLIB_RESOLVE(libc, ldexpl);
	DYNLIB_RESOLVE(libc, sqrtl);
	DYNLIB_RESOLVE(libc, feraiseexcept);
	DYNLIB_RESOLVE(libc, atan2f);
	DYNLIB_RESOLVE(libc, atanf);
	DYNLIB_RESOLVE(libc, fma);
	DYNLIB_RESOLVE(libc, fmaf);
	DYNLIB_RESOLVE(libc, strtod);
	DYNLIB_RESOLVE(libc, wcstod);
	DYNLIB_RESOLVE(libc, makecontext);
	DYNLIB_RESOLVE(libc, signalcontext);
	DYNLIB_RESOLVE(libc, sigblock);
	DYNLIB_RESOLVE(libc, sigsetmask);
	DYNLIB_RESOLVE(libc, sigvec);
	DYNLIB_RESOLVE(libc, alarm);
	DYNLIB_RESOLVE(libc, basename);
	DYNLIB_RESOLVE(libc, basename_r);
	DYNLIB_RESOLVE(libc, closedir);
	DYNLIB_RESOLVE(libc, daemon);
	DYNLIB_RESOLVE(libc, devname);
	DYNLIB_RESOLVE(libc, devname_r);
	DYNLIB_RESOLVE(libc, dirname);
	DYNLIB_RESOLVE(libc, err);
	DYNLIB_RESOLVE(libc, err_set_exit);
	DYNLIB_RESOLVE(libc, err_set_file);
	DYNLIB_RESOLVE(libc, errc);
	DYNLIB_RESOLVE(libc, errx);
	DYNLIB_RESOLVE(libc, verr);
	DYNLIB_RESOLVE(libc, verrc);
	DYNLIB_RESOLVE(libc, verrx);
	DYNLIB_RESOLVE(libc, vwarn);
	DYNLIB_RESOLVE(libc, vwarnc);
	DYNLIB_RESOLVE(libc, vwarnx);
	DYNLIB_RESOLVE(libc, warn);
	DYNLIB_RESOLVE(libc, warnc);
	DYNLIB_RESOLVE(libc, warnx);
	DYNLIB_RESOLVE(libc, getcwd);
	DYNLIB_RESOLVE(libc, gethostname);
	DYNLIB_RESOLVE(libc, fdopendir);
	DYNLIB_RESOLVE(libc, opendir);
	DYNLIB_RESOLVE(libc, posix_spawn);
	DYNLIB_RESOLVE(libc, posix_spawn_file_actions_addclose);
	DYNLIB_RESOLVE(libc, posix_spawn_file_actions_adddup2);
	DYNLIB_RESOLVE(libc, posix_spawn_file_actions_addopen);
	DYNLIB_RESOLVE(libc, posix_spawn_file_actions_destroy);
	DYNLIB_RESOLVE(libc, posix_spawn_file_actions_init);
	DYNLIB_RESOLVE(libc, posix_spawnattr_destroy);
	DYNLIB_RESOLVE(libc, posix_spawnattr_getflags);
	DYNLIB_RESOLVE(libc, posix_spawnattr_getpgroup);
	DYNLIB_RESOLVE(libc, posix_spawnattr_getschedparam);
	DYNLIB_RESOLVE(libc, posix_spawnattr_getschedpolicy);
	DYNLIB_RESOLVE(libc, posix_spawnattr_getsigdefault);
	DYNLIB_RESOLVE(libc, posix_spawnattr_getsigmask);
	DYNLIB_RESOLVE(libc, posix_spawnattr_init);
	DYNLIB_RESOLVE(libc, posix_spawnattr_setflags);
	DYNLIB_RESOLVE(libc, posix_spawnattr_setpgroup);
	DYNLIB_RESOLVE(libc, posix_spawnattr_setschedparam);
	DYNLIB_RESOLVE(libc, posix_spawnattr_setschedpolicy);
	DYNLIB_RESOLVE(libc, posix_spawnattr_setsigdefault);
	DYNLIB_RESOLVE(libc, posix_spawnattr_setsigmask);
	DYNLIB_RESOLVE(libc, posix_spawnp);
	DYNLIB_RESOLVE(libc, psignal);
	DYNLIB_RESOLVE(libc, readdir);
	DYNLIB_RESOLVE(libc, readdir_r);
	DYNLIB_RESOLVE(libc, rewinddir);
	DYNLIB_RESOLVE(libc, seekdir);
	DYNLIB_RESOLVE(libc, siginterrupt);
	DYNLIB_RESOLVE(libc, fstatvfs);
	DYNLIB_RESOLVE(libc, statvfs);
	DYNLIB_RESOLVE(libc, telldir);
	DYNLIB_RESOLVE(libc, utime);
	DYNLIB_RESOLVE(libc, inet_addr);
	DYNLIB_RESOLVE(libc, inet_aton);
	DYNLIB_RESOLVE(libc, inet_ntoa);
	DYNLIB_RESOLVE(libc, inet_ntoa_r);
	DYNLIB_RESOLVE(libc, freeifaddrs);
	DYNLIB_RESOLVE(libc, getifaddrs);
	DYNLIB_RESOLVE(libc, exit);
	DYNLIB_RESOLVE(libc, getenv);
	DYNLIB_RESOLVE(libc, putenv);
	DYNLIB_RESOLVE(libc, setenv);
	DYNLIB_RESOLVE(libc, unsetenv);
	DYNLIB_RESOLVE(libc, getopt_long);
	DYNLIB_RESOLVE(libc, getopt_long_only);
	DYNLIB_RESOLVE(libc, mergesort);
	DYNLIB_RESOLVE(libc, initstate);
	DYNLIB_RESOLVE(libc, random);
	DYNLIB_RESOLVE(libc, setstate);
	DYNLIB_RESOLVE(libc, srandom);
	DYNLIB_RESOLVE(libc, srandomdev);
	DYNLIB_RESOLVE(libc, reallocf);
	DYNLIB_RESOLVE(libc, realpath);
	DYNLIB_RESOLVE(libc, strtouq);
	DYNLIB_RESOLVE(libc, memrchr);
	DYNLIB_RESOLVE(libc, rindex);
	DYNLIB_RESOLVE(libc, stpcpy);
	DYNLIB_RESOLVE(libc, feclearexcept);
	DYNLIB_RESOLVE(libc, fedisableexcept);
	DYNLIB_RESOLVE(libc, feenableexcept);
	DYNLIB_RESOLVE(libc, fegetenv);
	DYNLIB_RESOLVE(libc, fegetexcept);
	DYNLIB_RESOLVE(libc, fegetexceptflag);
	DYNLIB_RESOLVE(libc, fegettrapenable);
	DYNLIB_RESOLVE(libc, feholdexcept);
	DYNLIB_RESOLVE(libc, fesetenv);
	DYNLIB_RESOLVE(libc, fesetexceptflag);
	DYNLIB_RESOLVE(libc, fesetround);
	DYNLIB_RESOLVE(libc, fesettrapenable);
	DYNLIB_RESOLVE(libc, fetestexcept);
	DYNLIB_RESOLVE(libc, feupdateenv);
	DYNLIB_RESOLVE(libc, tgamma);
	DYNLIB_RESOLVE(libc, exp2l);
	DYNLIB_RESOLVE(libc, acos);
	DYNLIB_RESOLVE(libc, acosf);
	DYNLIB_RESOLVE(libc, acosh);
	DYNLIB_RESOLVE(libc, acoshf);
	DYNLIB_RESOLVE(libc, acosl);
	DYNLIB_RESOLVE(libc, asin);
	DYNLIB_RESOLVE(libc, asinf);
	DYNLIB_RESOLVE(libc, asinl);
	DYNLIB_RESOLVE(libc, atan2);
	DYNLIB_RESOLVE(libc, atan2l);
	DYNLIB_RESOLVE(libc, atanh);
	DYNLIB_RESOLVE(libc, atanhf);
	DYNLIB_RESOLVE(libc, cosh);
	DYNLIB_RESOLVE(libc, coshf);
	DYNLIB_RESOLVE(libc, exp);
	DYNLIB_RESOLVE(libc, expf);
	DYNLIB_RESOLVE(libc, fmod);
	DYNLIB_RESOLVE(libc, fmodf);
	DYNLIB_RESOLVE(libc, fmodl);
	DYNLIB_RESOLVE(libc, gamma);
	DYNLIB_RESOLVE(libc, gammaf);
	DYNLIB_RESOLVE(libc, gammaf_r);
	DYNLIB_RESOLVE(libc, gamma_r);
	DYNLIB_RESOLVE(libc, hypot);
	DYNLIB_RESOLVE(libc, hypotf);
	DYNLIB_RESOLVE(libc, hypotl);
	DYNLIB_RESOLVE(libc, j0);
	DYNLIB_RESOLVE(libc, y0);
	DYNLIB_RESOLVE(libc, j0f);
	DYNLIB_RESOLVE(libc, y0f);
	DYNLIB_RESOLVE(libc, j1);
	DYNLIB_RESOLVE(libc, y1);
	DYNLIB_RESOLVE(libc, j1f);
	DYNLIB_RESOLVE(libc, y1f);
	DYNLIB_RESOLVE(libc, jn);
	DYNLIB_RESOLVE(libc, yn);
	DYNLIB_RESOLVE(libc, jnf);
	DYNLIB_RESOLVE(libc, ynf);
	DYNLIB_RESOLVE(libc, lgamma);
	DYNLIB_RESOLVE(libc, lgammaf);
	DYNLIB_RESOLVE(libc, lgammaf_r);
	DYNLIB_RESOLVE(libc, lgamma_r);
	DYNLIB_RESOLVE(libc, log);
	DYNLIB_RESOLVE(libc, log10);
	DYNLIB_RESOLVE(libc, log10f);
	DYNLIB_RESOLVE(libc, log2);
	DYNLIB_RESOLVE(libc, log2f);
	DYNLIB_RESOLVE(libc, logf);
	DYNLIB_RESOLVE(libc, pow);
	DYNLIB_RESOLVE(libc, powf);
	DYNLIB_RESOLVE(libc, scalb);
	DYNLIB_RESOLVE(libc, scalbf);
	DYNLIB_RESOLVE(libc, sinh);
	DYNLIB_RESOLVE(libc, sinhf);
	DYNLIB_RESOLVE(libc, remainder);
	DYNLIB_RESOLVE(libc, remainderf);
	DYNLIB_RESOLVE(libc, remainderl);
	DYNLIB_RESOLVE(libc, remquo);
	DYNLIB_RESOLVE(libc, remquof);
	DYNLIB_RESOLVE(libc, remquol);
	DYNLIB_RESOLVE(libc, sqrt);
	DYNLIB_RESOLVE(libc, sqrtf);
	DYNLIB_RESOLVE(libc, asinh);
	DYNLIB_RESOLVE(libc, asinhf);
	DYNLIB_RESOLVE(libc, atan);
	DYNLIB_RESOLVE(libc, atanl);
	DYNLIB_RESOLVE(libc, cbrt);
	DYNLIB_RESOLVE(libc, cbrtf);
	DYNLIB_RESOLVE(libc, cbrtl);
	DYNLIB_RESOLVE(libc, ceil);
	DYNLIB_RESOLVE(libc, ceilf);
	DYNLIB_RESOLVE(libc, ceill);
	DYNLIB_RESOLVE(libc, copysign);
	DYNLIB_RESOLVE(libc, copysignf);
	DYNLIB_RESOLVE(libc, copysignl);
	DYNLIB_RESOLVE(libc, cos);
	DYNLIB_RESOLVE(libc, cosf);
	DYNLIB_RESOLVE(libc, cosl);
	DYNLIB_RESOLVE(libc, erf);
	DYNLIB_RESOLVE(libc, erfc);
	DYNLIB_RESOLVE(libc, erfcf);
	DYNLIB_RESOLVE(libc, erff);
	DYNLIB_RESOLVE(libc, exp2);
	DYNLIB_RESOLVE(libc, exp2f);
	DYNLIB_RESOLVE(libc, expm1);
	DYNLIB_RESOLVE(libc, expm1f);
	DYNLIB_RESOLVE(libc, fabsf);
	DYNLIB_RESOLVE(libc, fabsl);
	DYNLIB_RESOLVE(libc, fdim);
	DYNLIB_RESOLVE(libc, fdimf);
	DYNLIB_RESOLVE(libc, fdiml);
	DYNLIB_RESOLVE(libc, finite);
	DYNLIB_RESOLVE(libc, finitef);
	DYNLIB_RESOLVE(libc, floor);
	DYNLIB_RESOLVE(libc, floorf);
	DYNLIB_RESOLVE(libc, floorl);
	DYNLIB_RESOLVE(libc, fmal);
	DYNLIB_RESOLVE(libc, fmax);
	DYNLIB_RESOLVE(libc, fmaxf);
	DYNLIB_RESOLVE(libc, fmaxl);
	DYNLIB_RESOLVE(libc, fmin);
	DYNLIB_RESOLVE(libc, fminf);
	DYNLIB_RESOLVE(libc, fminl);
	DYNLIB_RESOLVE(libc, frexp);
	DYNLIB_RESOLVE(libc, frexpf);
	DYNLIB_RESOLVE(libc, frexpl);
	DYNLIB_RESOLVE(libc, ilogb);
	DYNLIB_RESOLVE(libc, ilogbf);
	DYNLIB_RESOLVE(libc, ilogbl);
	DYNLIB_RESOLVE(libc, isnan);
	DYNLIB_RESOLVE(libc, isnanf);
	DYNLIB_RESOLVE(libc, llround);
#if 0
	DYNLIB_RESOLVE(libc, llroundf);
#endif
	DYNLIB_RESOLVE(libc, llroundl);
	DYNLIB_RESOLVE(libc, log1p);
	DYNLIB_RESOLVE(libc, log1pf);
	DYNLIB_RESOLVE(libc, logb);
	DYNLIB_RESOLVE(libc, logbf);
	DYNLIB_RESOLVE(libc, lround);
	DYNLIB_RESOLVE(libc, lroundf);
	DYNLIB_RESOLVE(libc, lroundl);
	DYNLIB_RESOLVE(libc, modff);
	DYNLIB_RESOLVE(libc, modfl);
	DYNLIB_RESOLVE(libc, nearbyint);
	DYNLIB_RESOLVE(libc, nearbyintf);
	DYNLIB_RESOLVE(libc, nearbyintl);
	DYNLIB_RESOLVE(libc, nextafter);
	DYNLIB_RESOLVE(libc, nextafterf);
	DYNLIB_RESOLVE(libc, nextafterl);
	DYNLIB_RESOLVE(libc, nexttowardl);
	DYNLIB_RESOLVE(libc, nexttoward);
	DYNLIB_RESOLVE(libc, nexttowardf);
	DYNLIB_RESOLVE(libc, rint);
	DYNLIB_RESOLVE(libc, rintf);
	DYNLIB_RESOLVE(libc, round);
	DYNLIB_RESOLVE(libc, roundf);
	DYNLIB_RESOLVE(libc, roundl);
	DYNLIB_RESOLVE(libc, scalbln);
	DYNLIB_RESOLVE(libc, scalblnf);
	DYNLIB_RESOLVE(libc, scalblnl);
//    DYNLIB_RESOLVE(libc, signgam); // FIXME
	DYNLIB_RESOLVE(libc, significand);
	DYNLIB_RESOLVE(libc, significandf);
	DYNLIB_RESOLVE(libc, sin);
	DYNLIB_RESOLVE(libc, sincos);
	DYNLIB_RESOLVE(libc, sincosf);
	DYNLIB_RESOLVE(libc, sinf);
	DYNLIB_RESOLVE(libc, sinl);
	DYNLIB_RESOLVE(libc, tan);
	DYNLIB_RESOLVE(libc, tanf);
	DYNLIB_RESOLVE(libc, tanh);
	DYNLIB_RESOLVE(libc, tanhf);
	DYNLIB_RESOLVE(libc, tanl);
	DYNLIB_RESOLVE(libc, tgammaf);
	DYNLIB_RESOLVE(libc, trunc);
	DYNLIB_RESOLVE(libc, truncf);
	DYNLIB_RESOLVE(libc, truncl);
	DYNLIB_RESOLVE(libc, drem);
	DYNLIB_RESOLVE(libc, dremf);
	DYNLIB_RESOLVE(libc, llrint);
	DYNLIB_RESOLVE(libc, llrintf);
	DYNLIB_RESOLVE(libc, llrintl);
	DYNLIB_RESOLVE(libc, logbl);
	DYNLIB_RESOLVE(libc, lrint);
	DYNLIB_RESOLVE(libc, lrintf);
	DYNLIB_RESOLVE(libc, lrintl);
	DYNLIB_RESOLVE(libc, rintl);
	DYNLIB_RESOLVE(libc, scalbn);
	DYNLIB_RESOLVE(libc, ldexpf);
	DYNLIB_RESOLVE(libc, scalbnf);
	DYNLIB_RESOLVE(libc, scalbnl);
	DYNLIB_RESOLVE(libc, memcmp);
	DYNLIB_RESOLVE(libc, strcmp);
	DYNLIB_RESOLVE(libc, clock_1700);
	DYNLIB_RESOLVE(libc, clock);
	DYNLIB_RESOLVE(libc, getprogname);
	DYNLIB_RESOLVE(libc, isinf);
	DYNLIB_RESOLVE(libc, time);
	DYNLIB_RESOLVE(libc, atof);
	DYNLIB_RESOLVE(libc, getopt);
	DLD_RESOLVE(libc, optarg, char *);
	DLD_RESOLVE(libc, opterr, int);
	DLD_RESOLVE(libc, optind, int);
	DLD_RESOLVE(libc, optopt, int);
	DLD_RESOLVE(libc, optreset, int);
	DYNLIB_RESOLVE(libc, flsl);
	DYNLIB_RESOLVE(libc, index);
	DYNLIB_RESOLVE(libc, strlcat);
	DYNLIB_RESOLVE(libc, strlcpy);
	DYNLIB_RESOLVE(libc, strndup);
	DYNLIB_RESOLVE(libc, strnlen);
	DYNLIB_RESOLVE(libc, strnstr);
	DYNLIB_RESOLVE(libc, strsep);
	DYNLIB_RESOLVE(libc, strspn);
	DYNLIB_RESOLVE(libc, longjmp);
	DYNLIB_RESOLVE(libc, setjmp);
#if 0
	DYNLIB_RESOLVE(libc, lldiv);
#endif
	DYNLIB_RESOLVE(libc, bcmp);
	DYNLIB_RESOLVE(libc, bzero);
	DYNLIB_RESOLVE(libc, strcat);
	DYNLIB_RESOLVE(libc, strcpy);

	return 0;
}